package com.totoro.tygeneratedragonblock.enums;

import com.totoro.tygeneratedragonblock.constants.CommandConst;
import com.totoro.tygeneratedragonblock.executor.command.MainCommandExecutor;
import com.totoro.tygeneratedragonblock.executor.command.impl.HelpCommandExecutor;
import com.totoro.tygeneratedragonblock.executor.command.impl.ReloadCommandExecutor;
import com.totoro.tygeneratedragonblock.executor.command.impl.RemoveCommandExecutor;
import com.totoro.tygeneratedragonblock.executor.command.impl.SpawnCommandExecutor;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Totoro
 * @version 0.1.0
 * @date 2025/8/10 - 19:42
 * @description
 **/
@AllArgsConstructor
@Getter
public enum CommandEnum {
    HELP_COMMAND(CommandConst.HELP, new HelpCommandExecutor()),
    SPAWN_COMMAND(CommandConst.SPAWN, new SpawnCommandExecutor()),
    REMOVE_COMMAND(CommandConst.REMOVE, new RemoveCommandExecutor()),
    RELOAD_COMMAND(CommandConst.RELOAD, new ReloadCommandExecutor());

    private final String commandArg;
    private final MainCommandExecutor mainCommandExecutor;


    public static CommandEnum getValue(String commandArg) {
        CommandEnum[] values = values();
        for (CommandEnum value : values) {
            if (value.commandArg.equalsIgnoreCase(commandArg)) {
                return value;
            }
        }
        return HELP_COMMAND;
    }

}
